package com.zzw.thread;

public class QuerySvc {

	 private String sql;
	 
	 private static ThreadLocal sqlHolder = new ThreadLocal();
	 
	 public QuerySvc() {
	  
	 }

	 public  void execute() {
		 System.out.println("Thread " + Thread.currentThread().getId() +" Sql  is " + sql);
		 System.out.println("Thread " + Thread.currentThread().getId() +" Thread Local variable Sql is " + sqlHolder.get());
	 }

	 public  String getSql() {
		 return sql;
	 }

	 public  void setSql(String sql) {
		 this.sql = sql;
		 sqlHolder.set(sql);
	 }
}
